<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>

<head>
    <title>服务记录</title>
</head>

<body>

<div id="wrapper">
    <div class="gray-bg">
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="tabs-container">
                <ul class="nav nav-tabs">
                    <li class=""><a  href="${ctx}/medical/sign/edit?id=${signId}">基本信息</a></li>
                    <li class=""><a  href="${ctx}/medical/sign/spck/list?id=${signId}">服务包</a></li>
                    <li class="active"><a  href="javascript:void(0)">服务记录</a></li>
                    <li class=""><a  href="${ctx}/medical/sign/deal/edit?id=${signId}">签约协议</a></li>
                </ul>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox">
                        <div class="ibox-content">
                            <div class="search-area">
                                <form role="form" class="form-inline" id="queryform">
                                    <input class="form-control  form-filter" type="hidden" name="ecn" value="${ecn}">
                                    <input class="form-control  form-filter" type="hidden" name="signId" value="${signId}">
                                </form>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover dataTables" id="data-table" style="word-break:break-all;"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>

<script src="${ctx}/static/inspinia/js/plugins/chosen/chosen.jquery.js"></script>
<script src="${ctx}/static/inspinia/js/plugins/layer/layer.js"></script>
<!-- Page-Level Scripts -->
<script>
    $(document).ready(function () {

        var setting = {
            "ajax": {
                "url": "${ctx}/medical/record/list_ecn",
                "type": "POST"
            },
            "columns": [
                {"title": "服务对象", "data": "ename", "width": "10%", "orderable": true},
                {"title": "手机号", "data": "emobile", "width": "10%", "orderable": false},
                {"title": "服务项", "data": "itemTitle", "width": "14%", "orderable": false},
                {"title": "服务包", "data": "packageTitle", "width": "12%", "orderable": false},
                {"title": "服务人", "data": "servantName", "width": "8%", "orderable": false},
                {"title": "服务时间", "data": "createTime", "width": "16%", "orderable": false},
                {"title": "服务说明", "data": "details", "width": "20%", "orderable": false},
                {"title": "操作", "data": null, "width": "10%", "orderable": false},
            ],
            "columnDefs": [
                {
                    "targets": 7,
                    "render": function (data, type, row, meta) {
                        return "<a class=' btn-xs default btn-editable' href='javascript:detail("+data.id+");' data-id='"+data.id+"'>详情</a>";
                    },
                    "orderable": false
                }
            ],
            "order": [
                [5, "desc"]
            ]
        };
        /* Init DataTables */
        $('#data-table').DataTable(ehconfig.get_datatable_config(setting));
        submitFilter = function () {
            $('#data-table').DataTable().draw();
        }
    });

    function detail(recordId) {
        var url = '${ctx}/medical/record/detail_ecn?id='+recordId;
        parent.layer.open({
            type: 2,
            title: "服务详情",
            shadeClose: true,
            shade: 0.8,
            area: ['780px', '450px'],
            content: url
        });
    }
    $(function () {
        $("#data-table").on("dblclick","tr",function(){
            var recordId = $(this).children("td:last-child").children("a").attr("data-id");
            if(recordId){
                detail(recordId);
            }
        })
    })

</script>

</body>

</html>
